package com.example.clienapp;

import androidx.appcompat.app.AppCompatActivity;

import android.content.ContentValues;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends AppCompatActivity {
    private static final String TAG ="tag";
    String AUTHORTIES="com.example.provider.test";
    Uri add_student=Uri.parse("content://"+AUTHORTIES+"/addStu");
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initData();
    }
    private void initData(){
        ContentValues cv=new ContentValues();
        cv.put("stu_name","张三");
        cv.put("stu_class","java");
        cv.put("stu_company","huawei");
        Uri newlyInsertItemUri=getContentResolver().insert(add_student,cv);
        Log.d(TAG,"最新一条数据的uri"+newlyInsertItemUri.toString());
    }
}